import _data from './_data';
import ws from './websocket';
import _action from './_action';
import onChat from './onmessage/onChat';
import onFriend from './onmessage/onFriend';
import onGroup from './onmessage/onGroup';
import onFriendCircle from './onmessage/onFriendCircle';
export default {
	...onChat,
	...onFriend,
	...onGroup,
	...onFriendCircle,
	tokenError(){
		uni.showToast({
			title: '登录失效',
		});
		_action.checkFail();
	},
	authFail(){
		_action.checkFail();
	},
	//保存接收到心跳包的时间
	ping(res) {
		const time = Date.parse(new Date())/1000
		_data.localData('socket_heartbeat',time)
	},
	/** 下线 */
	offline(res){
		uni.showModal({
			content: '你的账号在另一客户端登陆，如果不是你本人操作，请修改你的密码',
		});
		_action.checkFail();
	},
	/** 获得会话列表 */
	getChatList(){
		ws.getChatList();
	},
}
